package com.fz.Adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public abstract class MyBaseAdaper<T> extends BaseAdapter {
	protected List<T> name;
	protected LayoutInflater inflater;
	protected Context context;
	

	public MyBaseAdaper(Context context ) {
		super();
		this.context=context;
		name=new ArrayList<T>();
		inflater = LayoutInflater.from(context);
	}
	public void AddData(List<T> Data){
		
		this.name.addAll(Data);
	}
	public void AddTop(T t){
		name.add(0, t);
	}
	public void AddBottom(T t){
		name.add(t);
	}
	public void AddBottom(List<T> t){
		name.addAll(t);
	}
	public void AddTop(List<T> t){
		name.addAll(0, t);
	}

	@Override
	public int getCount() {
		return name.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return name.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return  arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		return getMyView(arg0, arg1, arg2);
	}
	 abstract View getMyView(int arg0, View arg1, ViewGroup arg2);

}
